# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=openscap
pkgver=1.4.3.r5.gdd3157225
pkgrel=1
pkgdesc='Open Source Security Compliance Solution.'
arch=('x86_64')
groups=('blackarch' 'blackarch-automation' 'blackarch-defensive'
        'blackarch-scanner')
url='https://www.open-scap.org/'
license=('GPL2')
depends=('acl' 'attr' 'bzip2' 'curl' 'dbus-glib' 'dbus' 'gconf' 'libcap-ng'
         'libcap' 'libgcrypt' 'libldap' 'libutil-linux' 'libxml2' 'libxslt'
         'openldap' 'pcre' 'pcre2' 'perl-xml-parser' 'perl-xml-xpath' 'perl'
         'procps-ng' 'python' 'swig' 'xmlsec')
makedepends=('cmake' 'git')
source=("git+https://github.com/OpenSCAP/$pkgname.git")
#source=("git+https://github.com/OpenSCAP/openscap/#branch=maint-${pkgver%.[0-9].r*}")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd $pkgname

  mkdir -p build
  cd build
  cmake -DCMAKE_INSTALL_PREFIX=/usr ..
  make
}

package() {
  cd "$pkgname/build"

  make DESTDIR="$pkgdir" install

  #mv "$pkgdir/usr/lib64/"* "$pkgdir/usr/lib/"
  #rmdir "$pkgdir/usr/lib64"

  #cp "$pkgdir/usr/lib/perl5/vendor_perl/${pkgname}_pm.so" \
  #  "$pkgdir/usr/share/perl5/5.32/vendor_perl/${pkgname}_pm.so"
  rm -rf "$pkgdir/usr/lib/perl5/vendor_perl"
}

